<?php
//ShareAction.class.php  分享
if(!defined("Yourphp")) exit("Access Denied");
class ShareAction extends BaseAction
{
    public function index(){
        $share = M('share')->where(array('id'=>$_GET['id']))->find();
        $t_comment = M('exam_record')->where(array('id'=>$share['exid']))->getField('exam_note');
        $c_comment = M('comment_company')->where(array('examrecordid'=>$share['exid'],'studentid'=>$share['user_id']))->select();
        foreach($c_comment as $k=>$v){
            $name = M('user')->where(array('id'=>$v['companyid']))->getField('realname');
            $c[$k]['name'] = $name;
            $c[$k]['comment'] = $v['comment'];
        }
        foreach($c as $k=>$v){
             if(!isset($co[$v['name']])){
                $co[$v['name']][]=$v;
            }else{
                $co[$v['name']][]=$v;
            }
        }
        $t = json_decode($t_comment,true);
        // print_r($t);
        $this->assign('t',$t);
        $this->assign('co',$co);
        $this->assign('share',$share);
        $this->display();
    }
}